package com.aya.simple.pull;

import java.util.Observable;
import java.util.Observer;

public class TemperatureObservable implements Observer, IDisplay {

    String temprature;

    @Override
    public void update(Observable o, Object arg) {
        if (o instanceof WeatherSubject) {
            WeatherSubject subject = (WeatherSubject) o;
            this.temprature = subject.getData().getTemperature();
            System.out.println("温度:" + temprature);
        }

    }

    @Override
    public void display() {
        System.out.println("温度:" + temprature);
    }
}
